package com.zb.vo;

import com.zb.entity.ZjFault;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/7/31 0031
 **/
@Data
@ApiModel("故障列表实体封装")
public class FaultsVo {
    @ApiModelProperty(value = "故障ID")
    private Long id;

    @ApiModelProperty(value = "故障名称")
    private String name;

    @ApiModelProperty(value = "所属知识库类型")
    private String knowledgeType;

    @ApiModelProperty(value = "故障状态：false-启用，true-禁用")
    private Boolean status;

    @ApiModelProperty(value = "故障内容")
    private String content;

    @ApiModelProperty(value = "解决方案内容")
    private String solution;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    public static FaultsVo beanToVo(ZjFault fault) {
        FaultsVo vo = new FaultsVo();
        BeanUtils.copyProperties(fault, vo);
        vo.setStatus(fault.getDisabled());
        vo.setCreateTime(fault.getGmtCreate());
        vo.setUpdateTime(fault.getGmtUpdate());
        return vo;
    }
}
